package com.qianfeng.zhangwei.sharepush;

import android.app.Application;
import android.app.Notification;

import cn.jpush.android.api.BasicPushNotificationBuilder;
import cn.jpush.android.api.CustomPushNotificationBuilder;
import cn.jpush.android.api.JPushInterface;
import cn.sharesdk.framework.ShareSDK;

/**
 * @说 明：
 * @项目名称：Sz1504Adv
 * @包 名： com.qianfeng.zhangwei.sharepush
 * @类 名： BaseApp
 * @创 建人： zhangwei
 * @创建时间：2015-08-10 11:02
 * @版 本：v1.0
 * @修 改人：
 * @修改时间：
 * @修改备注：
 *
 */
public class BaseApp extends Application {

    @Override
    public void onCreate() {
        super.onCreate();
        ShareSDK.initSDK(this);
        //初始化Jupsh
        JPushInterface.init(this);
        JPushInterface.setDebugMode(true);
        showBasicNotafication();
        showCustomNotification();
    }

    private void showBasicNotafication() {

        //自定义布局的通知栏
//        CustomPushNotificationBuilder builder =  new CustomPushNotificationBuilder(this)

        BasicPushNotificationBuilder builder = new BasicPushNotificationBuilder(this);
        builder.statusBarDrawable = R.mipmap.ic_launcher;
        builder.notificationFlags = Notification.DEFAULT_LIGHTS;
//        JPushInterface.setDefaultPushNotificationBuilder(builder);
        JPushInterface.setPushNotificationBuilder(1, builder);
    }

    public void showCustomNotification() {

        //上下文
        CustomPushNotificationBuilder builder = new CustomPushNotificationBuilder(this, R.layout.customer_notitfication_layout, R.id.icon, R.id.title, R.id.text);
        JPushInterface.setPushNotificationBuilder(2, builder);


    }


}
